<?php
class ActiveRecord extends CActiveRecord{
	public function getPictureUrl($attribute,$url)
	{
		if(trim($this->$attribute) != ""){
			return Yii::app()->baseUrl.Yii::app()->params[$url].'/'.$this->$attribute;
		}
		return "";
	}
	
	public function defaultScope(){
		return array(
			'condition'=>"{$this->getTableAlias(false,false)}.active=1",
		);
	}
	
	public function delete(){
		$this->active = 0;
		$this->saveAttributes(array('active'));
	}
}